home *** CD-ROM | disk | FTP | other *** search
- #!/usr/bin/perl
-
- $freelocation = "http://cavalcade-whimsey.com/addlinks.html";
- $freepath = "/usr/home/shpank/public_html/addlinks.html";
- $cgilocation = "http://cavalcade-whimsey.com/shpank/free.pl";
-
- # DO NOT EDIT BELOW THIS LINE!!!!
- #####################################################################
-
- # Receive Info From Free Link
- read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
-
- # Process Info From Free Link
- @pairs = split(/&/, $buffer);
- foreach $pair (@pairs) {
- ($name, $value) = split(/=/, $pair);
- $value =~ tr/+/ /;
- $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
- $value =~ s/<!--(.|\n)*-->//g;
- $value =~ s/<([^>]|\n)*>//g;
- $FORM{$name} = $value;}
-
- # Give Error Messages
- &no_url unless $FORM{'url'};
- &no_title unless $FORM{'title'};
-
- # Set Up Free Link Page
- open (FILE, "$freepath");
- @LINES=<FILE>;
- close(FILE);
- $SIZE=@LINES;
-
- # Write To Free Link Page
- open (FREE,">$freepath");
-
- for ($i=0;$i<=$SIZE;$i++) {
- $_=$LINES[$i];
- if (/<!--links-->/) {
-
- print FREE "<!--links-->\n";
- print FREE "<a href=\"$FORM{'url'}\">$FORM{'title'}</a> -
- $FORM{'description'}<br>\n"; } else {
- print FREE $_;
- }
- }
- close (FREE);
-
- &follow;
-
- # Error Pages
-
- sub no_url {
- print "Content-type: text/html\n\n";
- print "<html><head><title>No URL</title></head>\n";
- print "<body><h1>URL appears to be blank</h1>\n";
- print "You didn't add your URL so your entry to the Free Link Page was not added.\n";
- print "Please add your url below.<br>\n";
- print "<form method=POST action=\"$cgilocation\">\n";
- print "Page URL: <INPUT TYPE=\"text\" NAME=\"url\" VALUE=\"http://\" SIZE=\"40\">\n";
- print "<INPUT TYPE=\"hidden\" NAME=\"title\" VALUE=\"$FORM{'title'}\"><br><br>\n";
- print "<INPUT TYPE=\"hidden\" NAME=\"category\"\n";
- print "VALUE=\"$FORM{'category'}\"><br><br>\n";
- print "<input type=submit VALUE=\"Submit Link\"><hr>\n";
- print "</body></html>\n";
-
- exit;
- }
-
- sub no_title {
- print "Content-type: text/html\n\n";
- print "<html><head><title>No Title</title></head>\n";
- print "<body><h1>Title appears to be blank</h1>\n";
- print "You didn't add your Title so your entry to the Free Link Page was not added.\n";
- print "Please add your url below.<br>\n";
- print "<form method=POST action=\"$cgilocation\">\n";
- print "Page Title: <INPUT TYPE=\"text\" NAME=\"title\" SIZE=\"40\">\n";
- print "<INPUT TYPE=\"hidden\" NAME=\"url\" VALUE=\"$FORM{'url'}\"><br><br>\n";
- print "<INPUT TYPE=\"hidden\" NAME=\"category\"\n";
- print "VALUE=\"$FORM{'category'}\"><br><br>\n";
- print "<input type=submit VALUE=\"Submit Link\"><hr>\n";
- print "</body></html>\n";
-
- exit;
- }
-
- sub follow {
- print "Content-type: text/html\n\n";
- print "<html><head><title>Thank You</title></head>\n";
- print "<body bgcolor=#000000 text=#ff8000 link=#ffffff vlink=#ffffff><h1>Thank You For Adding a
- Link</h1>\n";
- print "Here's what you added:<br><br>\n";
- print "<b>Page URL:</b> $FORM{'url'}<br>\n";
- print "<b>Page Title:</b> $FORM{'title'}<br>\n";
- print "I really appreciate you adding your URL.<br>\n";
- print "Click here to go back to <a href=\"$freelocation\">The Free Links Page</a>.<br>\n ";
- print "If you do not see your entry, hit RELOAD<br>\n";
- print "</body></html>\n";
- }
- exit;
-